<?php
defined('BY_JYA') or exit('error');
$_RQ['op']=$_RQ['op']?$_RQ['op']:'main';
if($_RQ['op']=='main'){
	$return['ischecklogin']=model('jy_weishop/member')->checklogin('','','','',true);
	$type=intval($_RQ['type']);
	$return['setting']=$this->plugin_setting('page_setting');
	$return['list']=array();
	$return['params']=array('type'=>$type);
	$data['fee4all']=$this->sum('commission',array('mid'=>$_SESSION['uid'],'type'=>4,'uniacid'=>$_SESSION['uniacid']),'money');
	$data['fee4alldai']=$this->sum('commission',array('mid'=>$_SESSION['uid'],'type'=>4,'uniacid'=>$_SESSION['uniacid'],'status'=>array(0,1)),'money');
	$return['data']=$data;
	set_html('title','经销奖励明细');
	exi($return);
}
if($_RQ['op']=='list'){
	$params=array('type'=>4,'mid'=>$_SESSION['uid'],'uniacid'=>$_SESSION['uniacid']);
	if($_RQ['ordersn']){
		$params['ordersn']=$_RQ['ordersn'];
	}
	$psize=20;
	$pindex=intval($_RQ['page'])?:1;
	$parameter=array(
		'params'=>$params,
		'limit'=>array($pindex,$psize),
		'orderby'=>'id desc',
	);
	$list=$this->get_list('commission',$parameter);
	if(!$list){
		exi('none');
	}
	foreach($list as &$item){
		$item['status']=$this->model('model')->uplastfee($item);
		$item['member']=model('core/member')->basic($item['mid']);
		$item['statustitle']=$this->commission_status[$item['status']];	
		$item['typetitle']=$this->commission_money_types[$item['type']];
		$item['createtime']=date('Y-m-d H:i',$item['createtime']);
	}
	exi($list);
}
?>